/**
 * 
 */
package com.module.hq.bus.maps;

import com.module.hq.engine.HQController;
import com.module.hq.engine.HQMap;
import com.module.hq.engine.HQScript;
import com.module.hq.engine.HQTurn;

/**
 * @author Donald
 *
 */
public class MazeLoader {
	/**
	 * the one and only instance of the <code>MazeLoader</code> class.
	 */
	private static MazeLoader	instance;
	/**
	 * Gives access to the singleton instance of {@link MazeLoader}.
	 * @return {@link MazeLoader}
	 */
	public static MazeLoader getInstance() {
		if (MazeLoader.instance == null) {
			MazeLoader.instance = new MazeLoader();
		}
		return MazeLoader.instance;
	}
	public void loadMaze(final int mapNumber) throws Exception {
		switch (mapNumber) {
		case 0:
			Maze00.getInstance().load();
			break;
		}
		// center on the pc
		HQMap.getInstance().centerMapOnIO(HQController.getInstance().getPcId());
		// set turn 1
		HQScript.getInstance().setGlobalVariable("currentTurn", 
				new Integer(1));
		// switch to the PC's turn
		HQScript.getInstance().setGlobalVariable(
				"ioTurn", new Integer(HQController.getInstance().getPcId()));
		// reset move counter and check for spell effects
		HQTurn.getInstance().beginTurnForIOs();
	}
}
